import React, { useState, } from 'react';
import Button from './button';

const Input = () => {

  const [text, setText] = useState('');

  const onChangeInputSave = (ev) => {
    setText(ev.target.value);
  };

  const onClickAddItem = () => {
    setText('');
    return text;
  };

  return (
    <div>
      <input type="text" onChange={ onChangeInputSave } value={ text } />
      <Button type = "add" onClickAddItem={ onClickAddItem } />
    </div>
  );
};

export default Input;
